package com.nannybear.Controller;

import android.widget.LinearLayout;

import com.nannybear.Model.Graphic;
import com.nannybear.R;

/**
 * @brief this class permit add the temperature and the humidity graphics and make the link with the layout
 */
public class GraphsDrawer {
    /********** DECLARATIONS **********/
	private ViewPuppeteer viewPuppeteer;
	private Graphic tempGraph;
	private Graphic humGraph;

    /************ METHODS ************/
    /**
     * @brief constructor
     * @param viewPuppeteer : takes the class ViewPuppeeter in parameter
     */
	public GraphsDrawer(ViewPuppeteer viewPuppeteer) {
		this.viewPuppeteer = viewPuppeteer;
		tempGraph = new Graphic(viewPuppeteer.getmActivity());
		humGraph = new Graphic(viewPuppeteer.getmActivity());
		
		this.instanciationOfTheTwoGraphs();
		
	}

    /**
     * @brief instantiation of the two graphics layout
     */
	private void instanciationOfTheTwoGraphs(){
		//temperature graphic
		this.viewPuppeteer.getmActivity().getTempScreen().setGraphic_layout((LinearLayout) this.viewPuppeteer.getmActivity().findViewById(R.id.temp_graph));
		this.viewPuppeteer.getmActivity().getTempScreen().getGraphic_layout().addView(tempGraph.getGraphView());
	
		//humidity graphic
		this.viewPuppeteer.getmActivity().getHumidityScreen().setGraphic_layout((LinearLayout) this.viewPuppeteer.getmActivity().findViewById(R.id.hum_graph));
		this.viewPuppeteer.getmActivity().getHumidityScreen().getGraphic_layout().addView(humGraph.getGraphView());
	}
}
